package cinema.v1_0.util;

import java.util.Scanner;

public class ConsoleUtil {
    private static final Scanner sc = new Scanner(System.in);

    public static int readInt(String prompt) {
        while (true) {
            System.out.print(prompt);
            try {
                return Integer.parseInt(sc.nextLine().trim());
            } catch (NumberFormatException e) {
                System.out.println("请输入整数！");
            }
        }
    }

    public static String readLine(String prompt) {
        System.out.print(prompt);
        return sc.nextLine().trim();
    }

    public static void pause() {
        System.out.println("\n按回车继续...");
        sc.nextLine();
    }
}